package com.skyz.wrap.utils;

import java.math.BigDecimal;

public class MathUtil {

    public static double double2Scale(double value,int scale){
        BigDecimal two = new BigDecimal(value);
        double three = two.setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue();
        return three;
    }

    /**
     * 默认保留位数
     * @param value
     * @return
     */
    public static double double2DefScale(double value){
        return double2Scale(value,4);
    }
}
